<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>

<body>

<div data-id="1" data-span="哈哈">aaa</div>
<div data-id="2">bbb</div>
<div data-id="3">ccc</div>
<div data-id="4">ddd</div>
<div data-id="5">eee</div>

<script>
    const element = document.querySelector('div');
    console.log(element.dataset.id)
    console.log(element.dataset.span)
</script>
</body>
</html>